(function(t){"use strict";if(BX.PopupWindowManager){return}BX.PopupWindowManager={_popups:[],_currentPopup:null,create:function(t,e,i){var n=t;if(BX.type.isPlainObject(t)&&!e&&!i){n=t.id;if(!BX.type.isNotEmptyString(n)){throw new Error("BX.PopupWindowManager: 'id' parameter is required.")}}var o=this.getPopupById(n);if(o===null){o=new BX.PopupWindow(t,e,i);BX.addCustomEvent(o,"onPopupShow",BX.delegate(this.onPopupShow,this));BX.addCustomEvent(o,"onPopupClose",BX.delegate(this.onPopupClose,this))}return o},onPopupWindowIsInitialized:function(t,e){BX.addCustomEvent(e,"onPopupDestroy",BX.delegate(this.onPopupDestroy,this));this._popups.push(e)},onPopupShow:function(t){if(this._currentPopup!==null){this._currentPopup.close()}this._currentPopup=t},onPopupClose:function(t){this._currentPopup=null},onPopupDestroy:function(t){var e;if((e=this._getPopupIndex(t.uniquePopupId))!==-1){this._popups=BX.util.deleteFromArray(this._popups,e)}},getCurrentPopup:function(){return this._currentPopup},isPopupExists:function(t){return this._getPopupIndex(t)!==-1},isAnyPopupShown:function(){for(var t=0,e=this._popups.length;t<e;t++){if(this._popups[t].isShown()){return true}}return false},getPopupById:function(t){for(var e=0;e<this._popups.length;e++){if(this._popups[e].getId()===t){return this._popups[e]}}return null},_getPopupIndex:function(t){var e=-1;for(var i=0;i<this._popups.length;i++){if(this._popups[i].uniquePopupId===t){return i}}return e},getMaxZIndex:function(){var t=0,e;for(e=0;e<this._popups.length;e++){t=Math.max(t,this._popups[e].params.zIndex)}return t}};BX.addCustomEvent("onPopupWindowIsInitialized",BX.proxy(BX.PopupWindowManager.onPopupWindowIsInitialized,BX.PopupWindowManager));BX.PopupWindow=function(e,i,n){this.compatibleMode=n&&BX.type.isBoolean(n.compatibleMode)?n.compatibleMode:true;if(BX.type.isPlainObject(e)&&!i&&!n){n=e;e=n.id;i=n.bindElement;this.compatibleMode=false}n=n||{};this.params=n;if(!BX.type.isNotEmptyString(e)){e="popup-window-"+BX.util.getRandomString().toLowerCase()}BX.onCustomEvent("onPopupWindowInit",[e,i,n]);this.uniquePopupId=e;this.params.zIndex=BX.type.isNumber(n.zIndex)?parseInt(n.zIndex):0;this.params.zIndexAbsolute=BX.type.isNumber(n.zIndexAbsolute)?parseInt(n.zIndexAbsolute):0;this.buttons=n.buttons&&BX.type.isArray(n.buttons)?n.buttons:[];this.offsetTop=BX.PopupWindow.getOption("offsetTop");this.offsetLeft=BX.PopupWindow.getOption("offsetLeft");this.firstShow=false;this.bordersWidth=20;this.bindElementPos=null;this.closeIcon=null;this.resizeIcon=null;this.angle=null;this.overlay=null;this.titleBar=null;this.bindOptions=typeof n.bindOptions==="object"?n.bindOptions:{};this.autoHide=n.autoHide===true;this.autoHideHandler=BX.type.isFunction(n.autoHideHandler)?n.autoHideHandler:null;this.handleAutoHide=this.handleAutoHide.bind(this);this.handleOverlayClick=this.handleOverlayClick.bind(this);this.isAutoHideBinded=false;this.closeByEsc=n.closeByEsc===true;this.isCloseByEscBinded=false;this.cacheable=true;this.destroyed=false;this.width=null;this.height=null;this.minWidth=null;this.minHeight=null;this.maxWidth=null;this.maxHeight=null;this.padding=null;this.contentPadding=null;this.background=null;this.contentBackground=null;this.appendContainer=document.body;this.dragOptions={cursor:"",callback:BX.DoNothing,eventName:""};this.dragged=false;this.dragPageX=0;this.dragPageY=0;this.animationShowClassName=null;this.animationCloseClassName=null;this.animationCloseEventType=null;this.handleDocumentKeyUp=this.handleDocumentKeyUp.bind(this);this.handleResizeWindow=this.handleResizeWindow.bind(this);if(n.events){for(var o in n.events){BX.addCustomEvent(this,o,n.events[o])}}var s="popup-window";if(n.contentColor&&BX.type.isNotEmptyString(n.contentColor)){s+=" popup-window-content-"+n.contentColor}if(n.titleBar){s+=" popup-window-with-titlebar"}if(n.className&&BX.type.isNotEmptyString(n.className)){s+=" "+n.className}if(n.darkMode){s+=" popup-window-dark"}this.popupContainer=document.createElement("div");var p="popup-window-titlebar-"+e;if(n.titleBar){this.titleBar=BX.create("div",{props:{className:"popup-window-titlebar",id:p}})}if(n.closeIcon){this.closeIcon=BX.create("span",{props:{className:"popup-window-close-icon"+(n.titleBar?" popup-window-titlebar-close-icon":"")},style:typeof n.closeIcon==="object"?n.closeIcon:{},events:{click:BX.proxy(this.handleCloseIconClick,this)}});if(BX.browser.IsIE()){BX.adjust(this.closeIcon,{attrs:{hidefocus:"true"}})}}this.contentContainer=BX.create("div",{props:{id:"popup-window-content-"+e,className:"popup-window-content"}});BX.adjust(this.popupContainer,{props:{id:e,className:s},style:{zIndex:this.getZindex(),position:"absolute",display:"none",top:"0px",left:"0px"},children:[this.titleBar,this.contentContainer,this.closeIcon]});this.appendContainer.appendChild(this.popupContainer);this.buttonsContainer=null;if(n.angle){this.setAngle(n.angle)}if(n.overlay){this.setOverlay(n.overlay)}this.setOffset(n);this.setBindElement(i);this.setTitleBar(n.titleBar);this.setContent(n.content);this.setButtons(n.buttons);this.setWidth(n.width);this.setHeight(n.height);this.setMinWidth(n.minWidth);this.setMinHeight(n.minHeight);this.setMaxWidth(n.maxWidth);this.setMaxHeight(n.maxHeight);this.setResizeMode(n.resizable);this.setPadding(n.padding);this.setContentPadding(n.contentPadding);this.setBackground(n.background);this.setContentBackground(n.contentBackground);this.setAnimation(n.animation);this.setCacheable(n.cacheable);if(n.contentNoPaddings){this.setContentPadding(0)}if(n.noAllPaddings){this.setPadding(0);this.setContentPadding(0)}if(n.bindOnResize!==false){BX.bind(t,"resize",this.handleResizeWindow)}BX.onCustomEvent("onPopupWindowIsInitialized",[e,this])};BX.PopupWindow.prototype.getId=function(){return this.uniquePopupId};BX.PopupWindow.prototype.isCompatibleMode=function(){return this.compatibleMode};BX.PopupWindow.prototype.setContent=function(t){if(!this.contentContainer||!t){return}if(BX.type.isElementNode(t)){BX.cleanNode(this.contentContainer);var e=BX.type.isDomNode(t.parentNode);this.contentContainer.appendChild(t);if(this.isCompatibleMode()||e){t.style.display="block"}}else if(BX.type.isString(t)){this.contentContainer.innerHTML=t}else{this.contentContainer.innerHTML="&nbsp;"}};BX.PopupWindow.prototype.setButtons=function(t){this.buttons=t&&BX.type.isArray(t)?t:[];if(this.buttonsContainer){BX.remove(this.buttonsContainer)}if(this.buttons.length>0&&this.contentContainer){var e=[];for(var i=0;i<this.buttons.length;i++){var n=this.buttons[i];if(n instanceof BX.PopupWindowButton){n.popupWindow=this;e.push(n.render())}else if(n instanceof BX.UI.Button){n.setContext(this);e.push(n.render())}}this.buttonsContainer=this.contentContainer.parentNode.appendChild(BX.create("div",{props:{className:"popup-window-buttons"},children:e}))}};BX.PopupWindow.prototype.getButtons=function(){return this.buttons};BX.PopupWindow.prototype.getButton=function(t){for(var e=0;e<this.buttons.length;e++){var i=this.buttons[e];if(i.getId()===t){return i}}return null};BX.PopupWindow.prototype.setBindElement=function(t){if(t===null){this.bindElement=null}else if(typeof t==="object"){if(BX.type.isDomNode(t)||BX.type.isNumber(t.top)&&BX.type.isNumber(t.left)){this.bindElement=t}else if(BX.type.isNumber(t.clientX)&&BX.type.isNumber(t.clientY)){BX.fixEventPageXY(t);this.bindElement={left:t.pageX,top:t.pageY,bottom:t.pageY}}}};BX.PopupWindow.prototype.getBindElementPos=function(t){if(BX.type.isDomNode(t)){return BX.pos(t,false)}else if(t&&typeof t==="object"){if(!BX.type.isNumber(t.bottom)){t.bottom=t.top}return t}else{var e=BX.GetWindowInnerSize();var i=BX.GetWindowScrollPos();var n=this.getPopupContainer().offsetWidth;var o=this.getPopupContainer().offsetHeight;this.bindOptions.forceTop=true;return{left:e.innerWidth/2-n/2+i.scrollLeft,top:e.innerHeight/2-o/2+i.scrollTop,bottom:e.innerHeight/2-o/2+i.scrollTop,windowSize:e,windowScroll:i,popupWidth:n,popupHeight:o}}};BX.PopupWindow.prototype.setAngle=function(t){if(t===false){if(this.angle!==null){BX.remove(this.angle.element)}this.angle=null;return}var e="popup-window-angly";if(this.angle===null){var i=this.bindOptions.position&&this.bindOptions.position==="top"?"bottom":"top";var n=BX.PopupWindow.getOption(i==="top"?"angleMinTop":"angleMinBottom");var o=BX.type.isNumber(t.offset)?t.offset:0;var s=BX.PopupWindow.getOption("angleLeftOffset",null);if(o>0&&BX.type.isNumber(s)){o+=s-BX.PopupWindow.defaultOptions.angleLeftOffset}this.angle={element:BX.create("div",{props:{className:e+" "+e+"-"+i}}),position:i,offset:0,defaultOffset:Math.max(o,n)};this.getPopupContainer().appendChild(this.angle.element)}if(typeof t==="object"&&t.position&&BX.util.in_array(t.position,["top","right","bottom","left","hide"])){BX.removeClass(this.angle.element,e+"-"+this.angle.position);BX.addClass(this.angle.element,e+"-"+t.position);this.angle.position=t.position}if(typeof t==="object"&&BX.type.isNumber(t.offset)){var p=t.offset;var u,a;if(this.angle.position==="top"){u=BX.PopupWindow.getOption("angleMinTop");a=this.getPopupContainer().offsetWidth-BX.PopupWindow.getOption("angleMaxTop");a=a<u?Math.max(u,p):a;this.angle.offset=Math.min(Math.max(u,p),a);this.angle.element.style.left=this.angle.offset+"px";this.angle.element.style.marginLeft=0;this.angle.element.style.removeProperty("top")}else if(this.angle.position==="bottom"){u=BX.PopupWindow.getOption("angleMinBottom");a=this.getPopupContainer().offsetWidth-BX.PopupWindow.getOption("angleMaxBottom");a=a<u?Math.max(u,p):a;this.angle.offset=Math.min(Math.max(u,p),a);this.angle.element.style.marginLeft=this.angle.offset+"px";this.angle.element.style.left=0;this.angle.element.style.removeProperty("top")}else if(this.angle.position==="right"){u=BX.PopupWindow.getOption("angleMinRight");a=this.getPopupContainer().offsetHeight-BX.PopupWindow.getOption("angleMaxRight");a=a<u?Math.max(u,p):a;this.angle.offset=Math.min(Math.max(u,p),a);this.angle.element.style.top=this.angle.offset+"px";this.angle.element.style.removeProperty("left");this.angle.element.style.removeProperty("margin-left")}else if(this.angle.position==="left"){u=BX.PopupWindow.getOption("angleMinLeft");a=this.getPopupContainer().offsetHeight-BX.PopupWindow.getOption("angleMaxLeft");a=a<u?Math.max(u,p):a;this.angle.offset=Math.min(Math.max(u,p),a);this.angle.element.style.top=this.angle.offset+"px";this.angle.element.style.removeProperty("left");this.angle.element.style.removeProperty("margin-left")}}};BX.PopupWindow.prototype.getWidth=function(){return this.width};BX.PopupWindow.prototype.setWidth=function(t){this.setWidthProperty("width",t)};BX.PopupWindow.prototype.getHeight=function(){return this.height};BX.PopupWindow.prototype.setHeight=function(t){this.setHeightProperty("height",t)};BX.PopupWindow.prototype.getMinWidth=function(){return this.minWidth};BX.PopupWindow.prototype.setMinWidth=function(t){this.setWidthProperty("minWidth",t)};BX.PopupWindow.prototype.getMinHeight=function(){return this.minHeight};BX.PopupWindow.prototype.setMinHeight=function(t){this.setHeightProperty("minHeight",t)};BX.PopupWindow.prototype.getMaxWidth=function(){return this.maxWidth};BX.PopupWindow.prototype.setMaxWidth=function(t){this.setWidthProperty("maxWidth",t)};BX.PopupWindow.prototype.getMaxHeight=function(){return this.maxHeight};BX.PopupWindow.prototype.setMaxHeight=function(t){this.setHeightProperty("maxHeight",t)};BX.PopupWindow.prototype.setWidthProperty=function(t,e){var i=["width","minWidth","maxWidth"];if(i.indexOf(t)===-1){return}if(BX.type.isNumber(e)&&e>=0){this[t]=e;this.getResizableContainer().style[t]=e+"px";this.getContentContainer().style.overflowX="auto";this.getPopupContainer().classList.add("popup-window-fixed-width");if(this.getTitleContainer()&&BX.browser.IsIE11()){this.getTitleContainer().style[t]=e+"px"}}else if(e===null||e===false){this[t]=null;this.getResizableContainer().style.removeProperty(BX.util.getCssName(t));var n=i.some(function(t){return this.getResizableContainer().style.getPropertyValue(BX.util.getCssName(t))!==""},this);if(!n){this.getContentContainer().style.removeProperty("overflow-x");this.getPopupContainer().classList.remove("popup-window-fixed-width")}if(this.getTitleContainer()&&BX.browser.IsIE11()){this.getTitleContainer().style.removeProperty(BX.util.getCssName(t))}}};BX.PopupWindow.prototype.setHeightProperty=function(t,e){var i=["height","minHeight","maxHeight"];if(i.indexOf(t)===-1){return}if(BX.type.isNumber(e)&&e>=0){this[t]=e;this.getResizableContainer().style[t]=e+"px";this.getContentContainer().style.overflowY="auto";this.getPopupContainer().classList.add("popup-window-fixed-height")}else if(e===null||e===false){this[t]=null;this.getResizableContainer().style.removeProperty(BX.util.getCssName(t));var n=i.some(function(t){return this.getResizableContainer().style.getPropertyValue(BX.util.getCssName(t))!==""},this);if(!n){this.getContentContainer().style.removeProperty("overflow-y");this.getPopupContainer().classList.remove("popup-window-fixed-height")}}};BX.PopupWindow.prototype.setPadding=function(t){if(BX.type.isNumber(t)&&t>=0){this.padding=t;this.getPopupContainer().style.padding=t+"px"}else if(t===null){this.padding=null;this.getPopupContainer().style.removeProperty("padding")}};BX.PopupWindow.prototype.getPadding=function(){return this.padding};BX.PopupWindow.prototype.setContentPadding=function(t){if(BX.type.isNumber(t)&&t>=0){this.contentPadding=t;this.getContentContainer().style.padding=t+"px"}else if(t===null){this.contentPadding=null;this.getContentContainer().style.removeProperty("padding")}};BX.PopupWindow.prototype.getContentPadding=function(){return this.contentPadding};BX.PopupWindow.prototype.setBackground=function(t){if(BX.type.isNotEmptyString(t)){this.background=t;this.getPopupContainer().style.background=t}else if(t===null){this.background=null;this.getPopupContainer().style.removeProperty("background")}};BX.PopupWindow.prototype.getBackground=function(){return this.background};BX.PopupWindow.prototype.setContentBackground=function(t){if(BX.type.isNotEmptyString(t)){this.contentBackground=t;this.getContentContainer().style.background=t}else if(t===null){this.contentBackground=null;this.getContentContainer().style.removeProperty("background")}};BX.PopupWindow.prototype.getContentBackground=function(){return this.contentBackground};BX.PopupWindow.prototype.isDestroyed=function(){return this.destroyed};BX.PopupWindow.prototype.setCacheable=function(t){this.cacheable=t!==false};BX.PopupWindow.prototype.isCacheable=function(){return this.cacheable};BX.PopupWindow.prototype.setResizeMode=function(t){if(t===true||BX.type.isPlainObject(t)){if(!this.resizeIcon){this.resizeIcon=BX.create("div",{props:{className:"popup-window-resize"},events:{mousedown:BX.proxy(this.onResizeMouseDown,this)}});this.getPopupContainer().appendChild(this.resizeIcon)}this.setMinWidth(t.minWidth);this.setMinHeight(t.minHeight)}else if(t===false&&this.resizeIcon){BX.remove(this.resizeIcon);this.resizeIcon=null}};BX.PopupWindow.prototype.getPopupContainer=function(){return this.popupContainer};BX.PopupWindow.prototype.getContentContainer=function(){return this.contentContainer};BX.PopupWindow.prototype.getResizableContainer=function(){return BX.browser.IsIE11()?this.getContentContainer():this.getPopupContainer()};BX.PopupWindow.prototype.getTitleContainer=function(){return this.titleBar};BX.PopupWindow.prototype.onTitleMouseDown=function(t){this._startDrag(t,{cursor:"move",callback:BX.proxy(this.move,this),eventName:"Drag"})};BX.PopupWindow.prototype.onResizeMouseDown=function(t){this._startDrag(t,{cursor:"nwse-resize",eventName:"Resize",callback:BX.proxy(this._resize,this)});this.resizeContentPos=BX.pos(this.getResizableContainer());this.resizeContentOffset=this.resizeContentPos.left-BX.pos(this.getPopupContainer()).left};BX.PopupWindow.prototype._resize=function(t,e,i,n){var o=i-this.resizeContentPos.left;var s=n-this.resizeContentPos.top;var p=BX.GetWindowScrollSize().scrollWidth;if(this.resizeContentPos.left+o+this.resizeContentOffset>=p){o=p-this.resizeContentPos.left-this.resizeContentOffset}o=Math.max(o,this.getMinWidth());s=Math.max(s,this.getMinHeight());if(this.getMaxWidth()!==null){o=Math.min(o,this.getMaxWidth())}if(this.getMaxHeight()!==null){s=Math.min(s,this.getMaxHeight())}this.setWidth(o);this.setHeight(s)};BX.PopupWindow.prototype.isTopAngle=function(){return this.angle!==null&&this.angle.position==="top"};BX.PopupWindow.prototype.isBottomAngle=function(){return this.angle!==null&&this.angle.position==="bottom"};BX.PopupWindow.prototype.isTopOrBottomAngle=function(){return this.angle!==null&&BX.util.in_array(this.angle.position,["top","bottom"])};BX.PopupWindow.prototype.getAngleHeight=function(){return this.isTopOrBottomAngle()?BX.PopupWindow.getOption("angleTopOffset"):0};BX.PopupWindow.prototype.setOffset=function(t){if(!BX.type.isPlainObject(t)){return}if(BX.type.isNumber(t.offsetLeft)){this.offsetLeft=t.offsetLeft+BX.PopupWindow.getOption("offsetLeft")}if(BX.type.isNumber(t.offsetTop)){this.offsetTop=t.offsetTop+BX.PopupWindow.getOption("offsetTop")}};BX.PopupWindow.prototype.setTitleBar=function(t){if(!this.titleBar){return}if(typeof t==="object"&&BX.type.isDomNode(t.content)){this.titleBar.innerHTML="";this.titleBar.appendChild(t.content)}else if(typeof t==="string"){this.titleBar.innerHTML="";this.titleBar.appendChild(BX.create("span",{props:{className:"popup-window-titlebar-text"},text:t}))}if(this.params.draggable){this.titleBar.style.cursor="move";BX.bind(this.titleBar,"mousedown",BX.proxy(this.onTitleMouseDown,this))}};BX.PopupWindow.prototype.setClosingByEsc=function(t){t=BX.type.isBoolean(t)?t:true;if(t){this.closeByEsc=true;this.bindClosingByEsc()}else{this.closeByEsc=false;this.unbindClosingByEsc()}};BX.PopupWindow.prototype.bindClosingByEsc=function(){if(this.closeByEsc&&!this.isCloseByEscBinded){BX.bind(document,"keyup",this.handleDocumentKeyUp);this.isCloseByEscBinded=true}};BX.PopupWindow.prototype.unbindClosingByEsc=function(){if(this.isCloseByEscBinded){BX.unbind(document,"keyup",this.handleDocumentKeyUp);this.isCloseByEscBinded=false}};BX.PopupWindow.prototype.setAutoHide=function(t){t=BX.type.isBoolean(t)?t:true;if(t){this.autoHide=true;this.bindAutoHide()}else{this.autoHide=false;this.unbindAutoHide()}};BX.PopupWindow.prototype.bindAutoHide=function(){if(this.autoHide&&!this.isAutoHideBinded&&this.isShown()){this.isAutoHideBinded=true;if(this.isCompatibleMode()){BX.bind(this.getPopupContainer(),"click",this.cancelBubble)}if(this.overlay&&this.overlay.element){BX.bind(this.overlay.element,"click",this.handleOverlayClick)}else{if(this.isCompatibleMode()){BX.bind(document,"click",this.handleAutoHide)}else{document.addEventListener("click",this.handleAutoHide,true)}}}};BX.PopupWindow.prototype.unbindAutoHide=function(){if(this.isAutoHideBinded){this.isAutoHideBinded=false;if(this.isCompatibleMode()){BX.unbind(this.getPopupContainer(),"click",this.cancelBubble)}if(this.overlay&&this.overlay.element){BX.unbind(this.overlay.element,"click",this.handleOverlayClick)}else{if(this.isCompatibleMode()){BX.unbind(document,"click",this.handleAutoHide)}else{document.removeEventListener("click",this.handleAutoHide,true)}}}};BX.PopupWindow.prototype.handleAutoHide=function(t){if(this.isDestroyed()){return}if(this.autoHideHandler!==null){if(this.autoHideHandler(t)){this._tryCloseByEvent(t)}}else if(t.target!==this.getPopupContainer()&&!this.getPopupContainer().contains(t.target)){this._tryCloseByEvent(t)}};BX.PopupWindow.prototype._tryCloseByEvent=function(t){if(this.isCompatibleMode()){this.tryCloseByEvent(t)}else{setTimeout(BX.proxy(this.tryCloseByEvent,this),0,t)}};BX.PopupWindow.prototype.handleOverlayClick=function(t){this.tryCloseByEvent(t);t.stopPropagation()};BX.PopupWindow.prototype.setOverlay=function(t){if(this.overlay===null){this.overlay={element:BX.create("div",{props:{className:"popup-window-overlay",id:"popup-window-overlay-"+this.uniquePopupId}})};this.adjustOverlayZindex();this.resizeOverlay();this.appendContainer.appendChild(this.overlay.element)}if(t&&t.hasOwnProperty("opacity")&&BX.type.isNumber(t.opacity)&&t.opacity>=0&&t.opacity<=100){if(BX.browser.IsIE()&&!BX.browser.IsIE9()){this.overlay.element.style.filter="alpha(opacity="+t.opacity+")"}else{this.overlay.element.style.filter="none";this.overlay.element.style.opacity=parseFloat(t.opacity/100).toPrecision(3)}}if(t&&t.backgroundColor){this.overlay.element.style.backgroundColor=t.backgroundColor}};BX.PopupWindow.prototype.removeOverlay=function(){if(this.overlay!==null&&this.overlay.element!==null){BX.remove(this.overlay.element)}if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay=null};BX.PopupWindow.prototype.hideOverlay=function(){if(this.overlay!==null&&this.overlay.element!==null){if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay.element.style.display="none"}};BX.PopupWindow.prototype.showOverlay=function(){if(this.overlay!==null&&this.overlay.element!==null){this.overlay.element.style.display="block";var t=this.getPopupContainer().offsetHeight;this.overlayTimeout=setInterval(function(){if(t!==this.getPopupContainer().offsetHeight){this.resizeOverlay();t=this.getPopupContainer().offsetHeight}}.bind(this),1e3)}};BX.PopupWindow.prototype.resizeOverlay=function(){if(this.overlay!==null&&this.overlay.element!==null){var t=BX.GetWindowScrollSize();var e=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight);this.overlay.element.style.width=t.scrollWidth+"px";this.overlay.element.style.height=e+"px"}};BX.PopupWindow.prototype.getZindex=function(){if(this.overlay!==null){return this.params.zIndexAbsolute>0?this.params.zIndexAbsolute:BX.PopupWindow.getOption("popupOverlayZindex")+this.params.zIndex}else{return this.params.zIndexAbsolute>0?this.params.zIndexAbsolute:BX.PopupWindow.getOption("popupZindex")+this.params.zIndex}};BX.PopupWindow.prototype.adjustOverlayZindex=function(){if(this.overlay!==null&&this.overlay.element!==null){this.overlay.element.style.zIndex=parseInt(this.getPopupContainer().style.zIndex)-1}};BX.PopupWindow.prototype.show=function(){if(this.isShown()||this.isDestroyed()){return}if(!this.firstShow){BX.onCustomEvent(this,"onPopupFirstShow",[this]);this.firstShow=true}BX.onCustomEvent(this,"onPopupShow",[this]);this.showOverlay();this.getPopupContainer().style.display="block";this.adjustPosition();this.animateOpening(function(){if(this.isDestroyed()){return}BX.removeClass(this.getPopupContainer(),this.animationShowClassName);BX.onCustomEvent(this,"onAfterPopupShow",[this])}.bind(this));this.bindClosingByEsc();if(this.isCompatibleMode()){setTimeout(function(){this.bindAutoHide()}.bind(this),100)}else{this.bindAutoHide()}};BX.PopupWindow.prototype.animateOpening=function(t){BX.removeClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationShowClassName!==null){BX.addClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseEventType!==null){var e=this.animationCloseEventType+"end";this.getPopupContainer().addEventListener(e,function i(){this.removeEventListener(e,i);t()})}else{t()}}else{t()}};BX.PopupWindow.prototype.animateClosing=function(t){BX.removeClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseClassName!==null){BX.addClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationCloseEventType!==null){var e=this.animationCloseEventType+"end";this.getPopupContainer().addEventListener(e,function i(){this.removeEventListener(e,i);t()})}else{t()}}else{t()}};BX.PopupWindow.prototype.isShown=function(){return!this.isDestroyed()&&this.getPopupContainer().style.display==="block"};BX.PopupWindow.prototype.cancelBubble=function(e){e=e||t.event;if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}};BX.PopupWindow.prototype.close=function(){if(this.isDestroyed()||!this.isShown()){return}BX.onCustomEvent(this,"onPopupClose",[this]);if(this.isDestroyed()){return}this.animateClosing(function(){if(this.isDestroyed()){return}this.hideOverlay();this.getPopupContainer().style.display="none";BX.removeClass(this.getPopupContainer(),this.animationCloseClassName);this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout(function(){this.unbindAutoHide()}.bind(this),0)}else{this.unbindAutoHide()}BX.onCustomEvent(this,"onPopupAfterClose",[this]);if(!this.isCacheable()){this.destroy()}}.bind(this))};BX.PopupWindow.prototype.toggle=function(){this.isShown()?this.close():this.show()};BX.PopupWindow.prototype.tryCloseByEvent=function(t){if(this.isLeftButton(t)){this.close()}};BX.PopupWindow.prototype.setAnimation=function(t){if(BX.type.isPlainObject(t)){this.animationShowClassName=BX.type.isNotEmptyString(t.showClassName)?t.showClassName:null;this.animationCloseClassName=BX.type.isNotEmptyString(t.closeClassName)?t.closeClassName:null;this.animationCloseEventType=BX.util.in_array(t.closeAnimationType,["animation","transition"])?t.closeAnimationType:null}else if(BX.type.isNotEmptyString(t)){var e=t;if(e==="fading"){this.animationShowClassName="popup-window-show-animation-opacity";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}else if(e==="fading-slide"){this.animationShowClassName="popup-window-show-animation-opacity-transform";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}else if(e==="scale"){this.animationShowClassName="popup-window-show-animation-scale";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}}else if(t===false||t===null){this.animationShowClassName=null;this.animationCloseClassName=null;this.animationCloseEventType=null}};BX.PopupWindow.prototype.handleCloseIconClick=function(t){this.tryCloseByEvent(t);t.stopPropagation()};BX.PopupWindow.prototype.isLeftButton=function(t){return t.button===0};BX.PopupWindow.prototype.handleDocumentKeyUp=function(e){e=e||t.event;if(e.keyCode===27){n(this.getZindex(),BX.proxy(this.close,this))}};BX.PopupWindow.prototype.destroy=function(){BX.onCustomEvent(this,"onPopupDestroy",[this]);this.destroyed=true;this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout(function(){this.unbindAutoHide()}.bind(this),0)}else{this.unbindAutoHide()}BX.unbindAll(this);BX.unbind(document,"mousemove",BX.proxy(this._moveDrag,this));BX.unbind(document,"mouseup",BX.proxy(this._stopDrag,this));BX.unbind(t,"resize",this.handleResizeWindow);BX.remove(this.popupContainer);this.removeOverlay();this.popupContainer=null;this.contentContainer=null;this.closeIcon=null;this.titleBar=null;this.buttonsContainer=null;this.angle=null;this.resizeIcon=null};BX.PopupWindow.prototype.enterFullScreen=function(){if(BX.PopupWindow.fullscreenStatus){if(document.cancelFullScreen){document.cancelFullScreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}}else{if(BX.browser.IsChrome()||BX.browser.IsSafari()){this.contentContainer.webkitRequestFullScreen(this.contentContainer.ALLOW_KEYBOARD_INPUT);BX.bind(t,"webkitfullscreenchange",this.fullscreenBind=BX.proxy(this.eventFullScreen,this))}else if(BX.browser.IsFirefox()){this.contentContainer.mozRequestFullScreen(this.contentContainer.ALLOW_KEYBOARD_INPUT);BX.bind(t,"mozfullscreenchange",this.fullscreenBind=BX.proxy(this.eventFullScreen,this))}}};BX.PopupWindow.prototype.eventFullScreen=function(e){if(BX.PopupWindow.fullscreenStatus){if(BX.browser.IsChrome()||BX.browser.IsSafari()){BX.unbind(t,"webkitfullscreenchange",this.fullscreenBind)}else if(BX.browser.IsFirefox()){BX.unbind(t,"mozfullscreenchange",this.fullscreenBind)}BX.removeClass(this.contentContainer,"popup-window-fullscreen",[this.contentContainer]);BX.PopupWindow.fullscreenStatus=false;BX.onCustomEvent(this,"onPopupFullscreenLeave");this.adjustPosition()}else{BX.addClass(this.contentContainer,"popup-window-fullscreen");BX.PopupWindow.fullscreenStatus=true;BX.onCustomEvent(this,"onPopupFullscreenEnter",[this.contentContainer]);this.adjustPosition()}};BX.PopupWindow.prototype.adjustPosition=function(t){if(t&&typeof t==="object"){this.bindOptions=t}var e=this.getBindElementPos(this.bindElement);if(!this.bindOptions.forceBindPosition&&this.bindElementPos!==null&&e.top===this.bindElementPos.top&&e.left===this.bindElementPos.left){return}this.bindElementPos=e;var i=e.windowSize?e.windowSize:BX.GetWindowInnerSize();var n=e.windowScroll?e.windowScroll:BX.GetWindowScrollPos();var o=e.popupWidth?e.popupWidth:this.popupContainer.offsetWidth;var s=e.popupHeight?e.popupHeight:this.popupContainer.offsetHeight;var p=BX.PopupWindow.getOption("angleTopOffset");var u=this.bindElementPos.left+this.offsetLeft-(this.isTopOrBottomAngle()?BX.PopupWindow.getOption("angleLeftOffset"):0);if(!this.bindOptions.forceLeft&&u+o+this.bordersWidth>=i.innerWidth+n.scrollLeft&&i.innerWidth+n.scrollLeft-o-this.bordersWidth>0){var a=u;u=i.innerWidth+n.scrollLeft-o-this.bordersWidth;if(this.isTopOrBottomAngle()){this.setAngle({offset:a-u+this.angle.defaultOffset})}}else if(this.isTopOrBottomAngle()){this.setAngle({offset:this.angle.defaultOffset+(u<0?u:0)})}if(u<0){u=0}var r=0;if(this.bindOptions.position&&this.bindOptions.position==="top"){r=this.bindElementPos.top-s-this.offsetTop-(this.isBottomAngle()?p:0);if(r<0||!this.bindOptions.forceTop&&r<n.scrollTop){r=this.bindElementPos.bottom+this.offsetTop;if(this.angle!==null){r+=p;this.setAngle({position:"top"})}}else if(this.isTopAngle()){r=r-p+BX.PopupWindow.getOption("positionTopXOffset");this.setAngle({position:"bottom"})}else{r+=BX.PopupWindow.getOption("positionTopXOffset")}}else{r=this.bindElementPos.bottom+this.offsetTop+this.getAngleHeight();if(!this.bindOptions.forceTop&&r+s>i.innerHeight+n.scrollTop&&this.bindElementPos.top-s-this.getAngleHeight()>=0){r=this.bindElementPos.top-s;if(this.isTopOrBottomAngle()){r-=p;this.setAngle({position:"bottom"})}r+=BX.PopupWindow.getOption("positionTopXOffset")}else if(this.isBottomAngle()){r+=p;this.setAngle({position:"top"})}}if(r<0){r=0}BX.adjust(this.popupContainer,{style:{top:r+"px",left:u+"px",zIndex:this.getZindex()}});this.adjustOverlayZindex()};BX.PopupWindow.prototype.handleResizeWindow=function(t){if(this.isShown()){this.adjustPosition();if(this.overlay!==null){this.resizeOverlay()}}};BX.PopupWindow.prototype.move=function(t,e,i,n){var o=parseInt(this.popupContainer.style.left)+t;var s=parseInt(this.popupContainer.style.top)+e;if(typeof this.params.draggable==="object"&&this.params.draggable.restrict){if(o<0){o=0}var p=BX.GetWindowScrollSize();var u=this.popupContainer.offsetWidth;var a=this.popupContainer.offsetHeight;if(o>p.scrollWidth-u){o=p.scrollWidth-u}if(s>p.scrollHeight-a){s=p.scrollHeight-a}if(s<0){s=0}}this.popupContainer.style.left=o+"px";this.popupContainer.style.top=s+"px"};BX.PopupWindow.prototype._startDrag=function(e,i){e=e||t.event;BX.fixEventPageXY(e);i=i||{};if(BX.type.isNotEmptyString(i.cursor)){this.dragOptions.cursor=i.cursor}if(BX.type.isNotEmptyString(i.eventName)){this.dragOptions.eventName=i.eventName}if(BX.type.isFunction(i.callback)){this.dragOptions.callback=i.callback}this.dragPageX=e.pageX;this.dragPageY=e.pageY;this.dragged=false;BX.bind(document,"mousemove",BX.proxy(this._moveDrag,this));BX.bind(document,"mouseup",BX.proxy(this._stopDrag,this));if(document.body.setCapture){document.body.setCapture()}document.body.ondrag=BX.False;document.body.onselectstart=BX.False;document.body.style.cursor=this.dragOptions.cursor;document.body.style.MozUserSelect="none";this.popupContainer.style.MozUserSelect="none";return BX.PreventDefault(e)};BX.PopupWindow.prototype._moveDrag=function(e){e=e||t.event;BX.fixEventPageXY(e);if(this.dragPageX===e.pageX&&this.dragPageY===e.pageY){return}this.dragOptions.callback(e.pageX-this.dragPageX,e.pageY-this.dragPageY,e.pageX,e.pageY);this.dragPageX=e.pageX;this.dragPageY=e.pageY;if(!this.dragged){BX.onCustomEvent(this,"onPopup"+this.dragOptions.eventName+"Start",[this]);this.dragged=true}BX.onCustomEvent(this,"onPopup"+this.dragOptions.eventName,[this])};BX.PopupWindow.prototype._stopDrag=function(t){if(document.body.releaseCapture){document.body.releaseCapture()}BX.unbind(document,"mousemove",BX.proxy(this._moveDrag,this));BX.unbind(document,"mouseup",BX.proxy(this._stopDrag,this));document.body.ondrag=null;document.body.onselectstart=null;document.body.style.cursor="";document.body.style.MozUserSelect="";this.popupContainer.style.MozUserSelect="";BX.onCustomEvent(this,"onPopup"+this.dragOptions.eventName+"End",[this]);this.dragged=false;return BX.PreventDefault(t)};BX.PopupWindow.options={};BX.PopupWindow.defaultOptions={angleLeftOffset:40,positionTopXOffset:-11,angleTopOffset:10,popupZindex:1e3,popupOverlayZindex:1100,angleMinLeft:10,angleMaxLeft:30,angleMinRight:10,angleMaxRight:30,angleMinBottom:23,angleMaxBottom:25,angleMinTop:23,angleMaxTop:25,offsetLeft:0,offsetTop:0};BX.PopupWindow.setOptions=function(t){if(!t||typeof t!=="object"){return}for(var e in t){BX.PopupWindow.options[e]=t[e]}};BX.PopupWindow.getOption=function(t,e){if(typeof BX.PopupWindow.options[t]!=="undefined"){return BX.PopupWindow.options[t]}else if(typeof e!=="undefined"){return e}else{return BX.PopupWindow.defaultOptions[t]}};BX.PopupWindowButton=function(t){this.popupWindow=null;this.params=t||{};this.text=this.params.text||"";this.id=this.params.id||"";this.className=this.params.className||"";this.events=this.params.events||{};this.contextEvents={};for(var e in this.events){this.contextEvents[e]=BX.proxy(this.events[e],this)}this.buttonNode=BX.create("span",{props:{className:"popup-window-button"+(this.className.length>0?" "+this.className:""),id:this.id},events:this.contextEvents,text:this.text})};BX.PopupWindowButton.prototype.render=function(){return this.buttonNode};BX.PopupWindowButton.prototype.getId=function(){return this.id};BX.PopupWindowButton.prototype.getName=function(){return this.name};BX.PopupWindowButton.prototype.getContainer=function(){return this.buttonNode};BX.PopupWindowButton.prototype.setName=function(t){this.text=t||"";if(this.buttonNode){BX.cleanNode(this.buttonNode);BX.adjust(this.buttonNode,{text:this.text})}};BX.PopupWindowButton.prototype.setClassName=function(t){if(this.buttonNode){if(BX.type.isString(this.className)&&this.className!==""){BX.removeClass(this.buttonNode,this.className)}BX.addClass(this.buttonNode,t)}this.className=t};BX.PopupWindowButton.prototype.addClassName=function(t){if(this.buttonNode){BX.addClass(this.buttonNode,t);this.className=this.buttonNode.className}};BX.PopupWindowButton.prototype.removeClassName=function(t){if(this.buttonNode){BX.removeClass(this.buttonNode,t);this.className=this.buttonNode.className}};BX.PopupWindowButtonLink=function(t){BX.PopupWindowButtonLink.superclass.constructor.apply(this,arguments);this.buttonNode=BX.create("span",{props:{className:"popup-window-button popup-window-button-link"+(this.className.length>0?" "+this.className:""),id:this.id},text:this.text,events:this.contextEvents})};BX.extend(BX.PopupWindowButtonLink,BX.PopupWindowButton);BX.PopupWindowCustomButton=function(t){BX.PopupWindowCustomButton.superclass.constructor.apply(this,arguments);this.buttonNode=BX.create("span",{props:{className:this.className.length>0?this.className:"",id:this.id},events:this.contextEvents,text:this.text})};BX.extend(BX.PopupWindowCustomButton,BX.PopupWindowButton);BX.PopupMenu={Data:{},currentItem:null,show:function(t){if(this.currentItem!==null){this.currentItem.popupWindow.close()}this.currentItem=this.create.apply(this,arguments);this.currentItem.popupWindow.show()},create:function(t){var e=null;var i=arguments[1];var n=arguments[2];var o=arguments[3];if(BX.type.isPlainObject(t)&&!i&&!n&&!o){e=t.id;if(!BX.type.isNotEmptyString(e)){throw new Error("BX.PopupMenu.create: 'id' parameter is required.")}}else{e=t}if(!this.Data[e]){this.Data[e]=new BX.PopupMenuWindow(t,i,n,o);BX.addCustomEvent(this.Data[e],"onPopupMenuDestroy",this.onPopupDestroy.bind(this))}return this.Data[e]},getCurrentMenu:function(){return this.currentItem},getMenuById:function(t){return this.Data[t]?this.Data[t]:null},onPopupDestroy:function(t){this.destroy(t.id)},destroy:function(t){var e=this.getMenuById(t);if(e){if(this.currentItem===e){this.currentItem=null}e.popupWindow.destroy();delete this.Data[t]}}};BX.PopupMenuWindow=function(t,e,i,n){if(BX.type.isPlainObject(t)&&!e&&!i&&!n){n=t;n.compatibleMode=false;t=n.id;e=n.bindElement;i=n.items;if(!BX.type.isNotEmptyString(t)){t="menu-popup-"+BX.util.getRandomString().toLowerCase()}}this.id=t;this.bindElement=e;this.menuItems=[];this.itemsContainer=null;this.params=n&&typeof n==="object"?n:{};this.parentMenuWindow=null;this.parentMenuItem=null;if(i&&BX.type.isArray(i)){for(var o=0;o<i.length;o++){this.addMenuItemInternal(i[o],null)}}this.layout={menuContainer:null,itemsContainer:null};this.popupWindow=this.__createPopup()};BX.PopupMenuWindow.prototype.__createPopup=function(){var t=[];for(var e=0;e<this.menuItems.length;e++){var i=this.menuItems[e];var n=i.getLayout();t.push(n.item)}var o={closeByEsc:false,angle:false,autoHide:true,offsetTop:1,offsetLeft:0,animation:"fading"};var s=BX.mergeEx(o,this.params);s.noAllPaddings=true;s.darkMode=false;s.autoHideHandler=this.handleAutoHide.bind(this);s.content=this.layout.menuContainer=BX.create("div",{props:{className:"menu-popup"},children:[this.layout.itemsContainer=this.itemsContainer=BX.create("div",{props:{className:"menu-popup-items"},children:t})]});s.events={onPopupClose:this.onMenuWindowClose.bind(this),onPopupDestroy:this.onMenuWindowDestroy.bind(this)};var p=s.compatibleMode===false?this.getId():"menu-popup-"+this.getId();var u=new BX.PopupWindow(p,this.bindElement,s);if(this.params&&this.params.events){for(var a in this.params.events){if(this.params.events.hasOwnProperty(a)){BX.addCustomEvent(u,a,this.params.events[a])}}}return u};BX.PopupMenuWindow.prototype.getPopupWindow=function(){return this.popupWindow};BX.PopupMenuWindow.prototype.show=function(){BX.onCustomEvent(this,"onPopupMenuShow",[this]);this.getPopupWindow().show()};BX.PopupMenuWindow.prototype.close=function(){BX.onCustomEvent(this,"onPopupMenuClose",[this]);this.getPopupWindow().close()};BX.PopupMenuWindow.prototype.destroy=function(){BX.onCustomEvent(this,"onPopupMenuDestroy",[this]);this.getPopupWindow().destroy()};BX.PopupMenuWindow.prototype.toggle=function(){if(this.getPopupWindow().isShown()){this.close()}else{this.show()}};BX.PopupMenuWindow.prototype.getId=function(){return this.id};BX.PopupMenuWindow.prototype.onMenuWindowClose=function(){for(var t=0;t<this.menuItems.length;t++){var e=this.menuItems[t];e.closeSubMenu()}};BX.PopupMenuWindow.prototype.onMenuWindowDestroy=function(){for(var t=0;t<this.menuItems.length;t++){var e=this.menuItems[t];e.destroySubMenu()}};BX.PopupMenuWindow.prototype.handleAutoHide=function(t){return!this.containsTarget(t.target)};BX.PopupMenuWindow.prototype.containsTarget=function(t){var e=this.getPopupWindow().getPopupContainer();if(this.getPopupWindow().isShown()&&(t===e||e.contains(t))){return true}return this.getMenuItems().some(function(e){return e.getSubMenu()&&e.getSubMenu().containsTarget(t)})};BX.PopupMenuWindow.prototype.setParentMenuWindow=function(t){if(t instanceof BX.PopupMenuWindow){this.parentMenuWindow=t}};BX.PopupMenuWindow.prototype.getParentMenuWindow=function(){return this.parentMenuWindow};BX.PopupMenuWindow.prototype.getRootMenuWindow=function(){var t=null;var e=this.getParentMenuWindow();while(e!==null){t=e;e=e.getParentMenuWindow()}return t};BX.PopupMenuWindow.prototype.setParentMenuItem=function(t){if(t instanceof BX.PopupMenuItem){this.parentMenuItem=t}};BX.PopupMenuWindow.prototype.getParentMenuItem=function(){return this.parentMenuItem};BX.PopupMenuWindow.prototype.addMenuItem=function(t,e){var i=this.addMenuItemInternal(t,e);if(!i){return null}var n=i.getLayout();var o=this.getMenuItem(e);if(o!==null){var s=o.getLayout();this.itemsContainer.insertBefore(n.item,s.item)}else{this.itemsContainer.appendChild(n.item)}return i};BX.PopupMenuWindow.prototype.addMenuItemInternal=function(t,e){if(!t||!t.delimiter&&!BX.type.isNotEmptyString(t.text)||t.id&&this.getMenuItem(t.id)!==null){return null}if(BX.type.isNumber(this.params.menuShowDelay)){t.menuShowDelay=this.params.menuShowDelay}var i=new BX.PopupMenuItem(t);i.setMenuWindow(this);var n=this.getMenuItemPosition(e);if(n>=0){this.menuItems=BX.util.insertIntoArray(this.menuItems,n,i)}else{this.menuItems.push(i)}return i};BX.PopupMenuWindow.prototype.removeMenuItem=function(t){var e=this.getMenuItem(t);if(!e){return}for(var i=0;i<this.menuItems.length;i++){if(this.menuItems[i]===e){e.destroySubMenu();this.menuItems=BX.util.deleteFromArray(this.menuItems,i);break}}if(!this.menuItems.length){var n=e.getMenuWindow();if(n){var o=n.getParentMenuItem();if(o){o.destroySubMenu()}else{n.destroy()}}}e.layout.item.parentNode.removeChild(e.layout.item);e.layout={item:null,text:null}};BX.PopupMenuWindow.prototype.getMenuItem=function(t){for(var e=0;e<this.menuItems.length;e++){if(this.menuItems[e].id&&this.menuItems[e].id===t){return this.menuItems[e]}}return null};BX.PopupMenuWindow.prototype.getMenuItems=function(){return this.menuItems};BX.PopupMenuWindow.prototype.getMenuItemPosition=function(t){if(t){for(var e=0;e<this.menuItems.length;e++){if(this.menuItems[e].id&&this.menuItems[e].id===t){return e}}}return-1};BX.PopupMenuItem=function(t){t=t||{};this.options=t;this.id=t.id||BX.util.getRandomString().toLowerCase();this.text=BX.type.isNotEmptyString(t.text)?t.text:"";this.title=BX.type.isNotEmptyString(t.title)?t.title:"";this.delimiter=t.delimiter===true;this.href=BX.type.isNotEmptyString(t.href)?t.href:null;this.target=BX.type.isNotEmptyString(t.target)?t.target:null;this.dataset=BX.type.isPlainObject(t.dataset)?t.dataset:null;this.className=BX.type.isNotEmptyString(t.className)?t.className:null;this.menuShowDelay=BX.type.isNumber(t.menuShowDelay)?t.menuShowDelay:300;this.subMenuOffsetX=BX.type.isNumber(t.subMenuOffsetX)?t.subMenuOffsetX:4;this._items=BX.type.isArray(t.items)?t.items:[];this.disabled=t.disabled===true;this.cacheable=t.cacheable===true;this.onclick=BX.type.isNotEmptyString(t.onclick)||BX.type.isFunction(t.onclick)?t.onclick:null;if(BX.type.isPlainObject(t.events)){for(var e in t.events){BX.addCustomEvent(this,e,t.events[e])}}this.menuWindow=null;this.subMenuWindow=null;this.layout={item:null,text:null};this.getLayout();this.events={};this.items=[];for(var i in t){if(t.hasOwnProperty(i)&&typeof this[i]==="undefined"){this[i]=t[i]}}};BX.PopupMenuItem.prototype={getLayout:function(){if(this.layout.item){return this.layout}if(this.delimiter){if(BX.type.isNotEmptyString(this.text)){this.layout.item=BX.create("span",{props:{className:"popup-window-delimiter-section"},children:[this.layout.text=BX.create("span",{props:{className:"popup-window-delimiter-text"},html:this.text})]})}else{this.layout.item=BX.create("span",{props:{className:"popup-window-delimiter"}})}}else{this.layout.item=BX.create(this.href?"a":"span",{props:{className:["menu-popup-item",this.className?this.className:"menu-popup-no-icon",this.hasSubMenu()?"menu-popup-item-submenu":""].join(" ")},attrs:{title:this.title,onclick:BX.type.isString(this.onclick)?this.onclick:"",target:this.target?this.target:""},dataset:this.dataset,events:BX.type.isFunction(this.onclick)?{click:BX.delegate(this.onItemClick,this)}:null,children:[BX.create("span",{props:{className:"menu-popup-item-icon"}}),this.layout.text=BX.create("span",{props:{className:"menu-popup-item-text"},html:this.text})]});if(this.href){this.layout.item.href=this.href}if(this.isDisabled()){this.disable()}BX.bind(this.layout.item,"mouseenter",this.onItemMouseEnter.bind(this));BX.bind(this.layout.item,"mouseleave",this.onItemMouseLeave.bind(this))}return this.layout},getContainer:function(){return this.getLayout().item},getTextContainer:function(){return this.getLayout().text},getText:function(){return this.text},setText:function(t){if(BX.type.isString(t)){this.text=t;this.getTextContainer().innerHTML=t}},onItemClick:function(t){this.onclick.call(this.menuWindow,t,this)},onItemMouseEnter:function(t){if(this.isDisabled()){return}BX.onCustomEvent(this,"onMouseEnter");this.clearSubMenuTimeout();if(this.hasSubMenu()){this.subMenuTimeout=setTimeout(function(){this.showSubMenu()}.bind(this),this.menuShowDelay)}else{this.subMenuTimeout=setTimeout(function(){this.closeSiblings()}.bind(this),this.menuShowDelay)}},onItemMouseLeave:function(t){if(this.isDisabled()){return}BX.onCustomEvent(this,"onMouseLeave");this.clearSubMenuTimeout()},clearSubMenuTimeout:function(){if(this.subMenuTimeout){clearTimeout(this.subMenuTimeout)}this.subMenuTimeout=null},hasSubMenu:function(){return this.subMenuWindow!==null||this._items.length},showSubMenu:function(){this.addSubMenu(this._items);if(this.subMenuWindow){BX.addClass(this.layout.item,"menu-popup-item-open");this.closeSiblings();this.closeChildren();var t=this.subMenuWindow.getPopupWindow();if(!t.isShown()){BX.onCustomEvent(this,"onSubMenuShow");t.show()}this.adjustSubMenu()}},addSubMenu:function(t){if(this.subMenuWindow!==null||!BX.type.isArray(t)||!t.length){return null}var e=this.getMenuWindow().getRootMenuWindow()||this.getMenuWindow();var i=e.params;i.autoHide=false;i.menuShowDelay=this.menuShowDelay;i.cacheable=this.isCacheable();i.zIndexAbsolute=this.getMenuWindow().getPopupWindow().getZindex()+2;i.bindOptions={forceTop:true,forceLeft:true,forceBindPosition:true};delete i.zIndex;delete i.events;delete i.angle;delete i.overlay;this.subMenuWindow=new BX.PopupMenuWindow("popup-submenu-"+this.id,this.layout.item,t,i);this.subMenuWindow.setParentMenuWindow(this.getMenuWindow());this.subMenuWindow.setParentMenuItem(this);BX.addCustomEvent(this.subMenuWindow.getPopupWindow(),"onPopupDestroy",this.handleSubMenuDestroy.bind(this));BX.addClass(this.layout.item,"menu-popup-item-submenu");return this.subMenuWindow},handleSubMenuDestroy:function(){this.subMenuWindow=null},closeSubMenu:function(){this.clearSubMenuTimeout();if(this.subMenuWindow){BX.removeClass(this.layout.item,"menu-popup-item-open");this.closeChildren();var t=this.subMenuWindow.getPopupWindow();if(t.isShown()){BX.onCustomEvent(this,"onSubMenuClose")}this.subMenuWindow.close()}},closeSiblings:function(){var t=this.menuWindow.getMenuItems();for(var e=0;e<t.length;e++){if(t[e]!==this){t[e].closeSubMenu()}}},closeChildren:function(){if(this.subMenuWindow){var t=this.subMenuWindow.getMenuItems();for(var e=0;e<t.length;e++){t[e].closeSubMenu()}}},destroySubMenu:function(){if(this.subMenuWindow){BX.removeClass(this.layout.item,"menu-popup-item-open menu-popup-item-submenu");this.destroyChildren();this.subMenuWindow.destroy();this.subMenuWindow=null;this._items=[]}},destroyChildren:function(){if(this.subMenuWindow){var t=this.subMenuWindow.getMenuItems();for(var e=0;e<t.length;e++){t[e].destroySubMenu()}}},adjustSubMenu:function(){if(!this.subMenuWindow||!this.layout.item){return}var t=this.subMenuWindow.getPopupWindow();var e=this.layout.item.getBoundingClientRect();var i=e.width+this.subMenuOffsetX;var n=e.height+this.getPopupPadding();var o=e.height/2-this.getPopupPadding();var s="left";var p=t.getPopupContainer().offsetWidth;var u=t.getPopupContainer().offsetHeight;var a=e.top+u;var r=document.documentElement.clientWidth;var l=document.documentElement.clientHeight;var h=a-l;if(h>0){var d=Math.ceil(h/e.height)*e.height;if(d>e.top){d-=Math.ceil((d-e.top)/e.height)*e.height}if(e.bottom>a-d){d-=e.bottom-(a-d)+this.getPopupPadding()}n+=d;o+=d}if(e.left+i+p>r){var f=e.left-p-this.subMenuOffsetX;if(f>0){i=-p-this.subMenuOffsetX;s="right"}}t.setBindElement(this.layout.item);t.setOffset({offsetLeft:i,offsetTop:-n});t.setAngle({position:s,offset:o});t.adjustPosition()},getPopupPadding:function(){if(!BX.type.isNumber(this.popupPadding)){if(this.subMenuWindow){var t=this.subMenuWindow.layout.menuContainer;this.popupPadding=parseInt(BX.style(t,"paddingTop"),10)}else{this.popupPadding=0}}return this.popupPadding},getSubMenu:function(){return this.subMenuWindow},getId:function(){return this.id},setMenuWindow:function(t){this.menuWindow=t},getMenuWindow:function(){return this.menuWindow},getMenuShowDelay:function(){return this.menuShowDelay},enable:function(){this.disabled=false;this.getContainer().classList.remove("menu-popup-item-disabled")},disable:function(){this.disabled=true;this.closeSubMenu();this.getContainer().classList.add("menu-popup-item-disabled")},isDisabled:function(){return this.disabled},setCacheable:function(t){this.cacheable=t!==false},isCacheable:function(){return this.cacheable}};t.BXInputPopup=function(t){this.id=t.id||"bx-inp-popup-"+Math.round(Math.random()*1e6);this.handler=t.handler||false;this.values=t.values||false;this.pInput=t.input;this.bValues=!!this.values;this.defaultValue=t.defaultValue||"";this.openTitle=t.openTitle||"";this.className=t.className||"";this.noMRclassName=t.noMRclassName||"ec-no-rm";this.emptyClassName=t.noMRclassName||"ec-label";var e=this;this.curInd=false;if(this.bValues){this.pInput.onfocus=this.pInput.onclick=function(t){if(this.value==e.defaultValue){this.value="";this.className=e.className}e.ShowPopup();return BX.PreventDefault(t)};this.pInput.onblur=function(){if(e.bShowed)setTimeout(function(){e.ClosePopup(true)},200);e.OnChange()}}else{this.pInput.className=this.noMRclassName;this.pInput.onblur=BX.proxy(this.OnChange,this)}};BXInputPopup.prototype={ShowPopup:function(){if(this.bShowed)return;var t=this;if(!this.oPopup){var e,i=BX.create("DIV",{props:{className:"bxecpl-loc-popup "+this.className}});for(var n=0,o=this.values.length;n<o;n++){e=i.appendChild(BX.create("DIV",{props:{id:"bxecmr_"+n},text:this.values[n].NAME,events:{mouseover:function(){BX.addClass(this,"bxecplloc-over")},mouseout:function(){BX.removeClass(this,"bxecplloc-over")},click:function(){var e=this.id.substr("bxecmr_".length);t.pInput.value=t.values[e].NAME;t.curInd=e;t.OnChange();t.ClosePopup(true)}}}));if(this.values[n].DESCRIPTION)e.title=this.values[n].DESCRIPTION;if(this.values[n].CLASS_NAME)BX.addClass(e,this.values[n].CLASS_NAME);if(this.values[n].URL)e.appendChild(BX.create("A",{props:{href:this.values[n].URL,className:"bxecplloc-view",target:"_blank",title:this.openTitle}}))}this.oPopup=new BX.PopupWindow(this.id,this.pInput,{autoHide:true,offsetTop:1,offsetLeft:0,lightShadow:true,closeByEsc:true,content:i});BX.addCustomEvent(this.oPopup,"onPopupClose",BX.proxy(this.ClosePopup,this))}this.oPopup.show();this.pInput.select();this.bShowed=true;BX.onCustomEvent(this,"onInputPopupShow",[this])},ClosePopup:function(t){this.bShowed=false;if(this.pInput.value=="")this.OnChange();BX.onCustomEvent(this,"onInputPopupClose",[this]);if(t===true)this.oPopup.close()},OnChange:function(){var t=this.pInput.value;if(this.bValues){if(this.pInput.value==""||this.pInput.value==this.defaultValue){this.pInput.value=this.defaultValue;this.pInput.className=this.emptyClassName;t=""}else{this.pInput.className=""}}if(isNaN(parseInt(this.curInd))||this.curInd!==false&&t!=this.values[this.curInd].NAME)this.curInd=false;else this.curInd=parseInt(this.curInd);BX.onCustomEvent(this,"onInputPopupChanged",[this,this.curInd,t]);if(this.handler&&typeof this.handler=="function")this.handler({ind:this.curInd,value:t})},Set:function(t,e,i){this.curInd=t;if(this.curInd!==false)this.pInput.value=this.values[this.curInd].NAME;else this.pInput.value=e;if(i!==false)this.OnChange()},Get:function(t){var e=false;if(typeof t=="undefined")t=this.curInd;if(t!==false&&this.values[t])e=this.values[t].ID;return e},GetIndex:function(t){for(var e=0,i=this.values.length;e<i;e++)if(this.values[e].ID==t)return e;return false},Deactivate:function(t){if(this.pInput.value==""||this.pInput.value==this.defaultValue){if(t){this.pInput.value="";this.pInput.className=this.noMRclassName}else if(this.oEC.bUseMR){this.pInput.value=this.defaultValue;this.pInput.className=this.emptyClassName}}this.pInput.disabled=t}};var e=-1,i=null;function n(t,o){if(t===false){if(i&&i.length>0){for(var s=0;s<i.length;s++){i[s]()}i=null;e=-1}}else{if(i===null){i=[];e=-1;BX.defer(n)(false)}if(t>e){e=t;i=[o]}else if(t==e){i.push(o)}}}})(window);
//# sourceMappingURL=old_core_popup.bundle.map.js